function register(){
    var username = $("#username").val();
    var password = $("#password").val();
    var phonenum = $("#phonenum").val();
   
        $.ajax({
            url: '/register',
            method: 'post',
            datatype: 'json',
            data: {
                username:username,
                password:password,
                phonenum:phonenum 
            },
            success: function(data) {
                if(username != ""){
                    console.log(data.message)
                    if(data.message == "false"){
                        confirm("用户名已存在")
                    }else{
                        confirm('注册成功')
                        window.location.href='/login'
                    }
                }else{
                    if(username == ""){
                        confirm("用户名不能为空")
                    }
                    if(password == ""){
                        confirm("密码不能为空")
                    }
                    if(phonenum == ""){
                        confirm("电话号码不能为空")
                    }
                } 
            },
            datatype: 'text'
        })
      
}